package com.sakiko.controller;

import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName: com.sakiko.controller
 *
 * @author: Yang
 * description:
 * time: 2025/8/9 22:35
 */
@RestController
@Slf4j
public class HelloLangChain4JController {

    @Resource
    private ChatModel chatModel;

    @GetMapping("/langchain4j/hello")
    public String hello(@RequestParam(value = "question", defaultValue = "你是谁") String question) {
        String res = chatModel.chat(question);
        System.out.println("res = " + res);
        return res;
    }
}
